    $(document).on('pagebeforeshow', '#options', function(){   
        setStyle("mainforum");
        
        //change hardware accel
        if (window.localStorage.getItem("sAccel") == 'on'){
            $('#flipswitch').val('on').slider("refresh");
        }
        
        
        $('#flipswitch').change( function(event, ui) {  
            var r = confirm("Для вступления изменений необходим перезапуск");
            if (r == true)
              {
                window.localStorage.setItem("sAccel", $('#flipswitch').val() );
                r = null;
                window.parent.setTimeout(toSave,0);
              }else{
                  $('#flipswitch').val(window.localStorage.getItem("sAccel")).slider("refresh");
                  console.log("flipswitch default");
              }
        });
      
      //change fond-size
        var listCount = window.localStorage.getItem("listCount");
        if (listCount == null)
            listCount = 15;
        $('#slider-s').val(listCount).slider("refresh");
        
        $( "#slider-s").on('slidestop', function( event ) {
            window.localStorage.setItem("listCount", $('#slider-s').val());
         });
        
    });  
    
    function clearChap(){
        var r = confirm("Стереть все закладки?");
        if (r == true){
            var db = getBD();
            db.transaction(clrChapterBD, errorCB, successCB);
        }
    }
    
    function clrChapterBD(tx){
        tx.executeSql('DROP TABLE IF EXISTS chapters');
    }
    
    //to save hardware status in file on sd
    
    //start to save
    function toSave(){
        window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
    }
    
    //get fileentry of file to save
    function gotFS(fileSystem) {
        fileSystem.root.getFile("anibox/anibox.txt", {create: true, exclusive: false}, gotFileEntry, fail);
    }
    
    //error
    function fail(error) {
        console.log("Failed to retrieve file: " + error.code);
    }
    
    //for write status to file
    function gotFileEntry(entry){
        entry.createWriter(gotFileWriter, fail);
    }
    
    //save status of hardware to file and exit app
    function gotFileWriter(writer){
        writer.write($('#flipswitch').val());
        navigator.app.exitApp();
    }